﻿using System;

namespace Sencha.Serialization
{
	public interface IJsonReader
    {
		ISerializationContext Context { get; }

		JsonToken Token { get; }
		object RawValue { get; }
		IValueInfo Value { get; }
		long CharactersReaded { get; }

        bool NextToken();

		bool IsEndOfStream();

		/// <summary>
		/// Resets Line/Column numbers, CharactersReaded and Token information of reader
		/// </summary>
		void Reset();
    }

	public interface IValueInfo
	{
		bool HasValue { get; }
		object Raw { get; }
		Type RawType { get; }
		bool AsBoolean { get; }
		byte AsByte { get; }
		short AsInt16 { get; }
		int AsInt32 { get; }
		long AsInt64 { get; }
		sbyte AsSByte { get; }
		ushort AsUInt16 { get; }
		uint AsUInt32 { get; }
		ulong AsUInt64 { get; }
		float AsSingle { get; }
		double AsDouble { get; }
		decimal AsDecimal { get; }
		string AsString { get; }
		DateTime AsDateTime { get; }

		int LineNumber { get; }
		int ColumnNumber { get; }

		T AsType<T>();

		void CopyJsonTo(System.Text.StringBuilder stringBuilder);
		void CopyJsonTo(System.IO.TextWriter writer);
		void CopyJsonTo(System.IO.Stream stream);
		void CopyJsonTo(IJsonWriter writer);
	}
}
